import React, { Component, PropTypes } from 'react';
import Module from '../../lib/module';




class radarChart extends Module{
    constructor(props, context) {
        super(props, context);
        this.state = {
        };
    }

    componentDidMount() {
        this.showChart()
    }

    componentWillUnmount() {
        this.showChart()
    }

    showChart (){
        let radar = echarts.init(document.getElementById('radar'));
        let option = {
            tooltip: {
                trigger: 'axis'
            },
            radar: [
                {
                    indicator: [
                        {text: '碰撞', max: 100},
                        {text: '速度', max: 100},
                        {text: '超车', max: 100},
                        {text: '攻击', max: 100},
                        {text: '支援', max: 100},
                        {text: '防御', max: 100},
                    ],
                    center: ['50%','50%'],
                    radius: 60
                },
            ],
            series: [
                {
                    type: 'radar',
                    tooltip: {
                        trigger: 'item'
                    },
                    itemStyle: {normal: {areaStyle: {type: 'default'}}},
                    data: [
                        {
                            value: [60,73,85,40,30,50],
                            name: '某软件'
                        }
                    ]
                },
            ]
        };
        radar.setOption(option);
    }

    render() {
        return <div className="radar-chart" id="radar">
        </div>
    }
}
export default radarChart;